﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.SimpleFlow
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.SimpleFlow;

    public class MapForsfTypeStepRole : EntityMapping<sfTypeStepRole>
    {
        public MapForsfTypeStepRole()
        {
            Property(x => x.Code, map =>
            {
                map.Length(40);
            });

            Property(x => x.Describe, map =>
            {
                map.Length(4000000);
            });

            //用户-角色映射（多对多）
            Bag(x => x.RoleUsers, map =>
            {
                map.Table("ref_Role_to_Users");
                map.Key(keyMapper => keyMapper.Column("RoleId"));
            }, act => act.ManyToMany(m => m.Column("UserId")));
        }
    }
}
